package com.hongdee.base.car.dao.impl;

import com.hongdee.base.basedao.impl.BaseDaoImpl;
import com.hongdee.base.car.dao.ICarDao;
import com.hongdee.base.car.entity.TBcCar;
import com.hongdee.base.car.entity.TBcCarTwo;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by My on 2017/2/13.
 */
@Service
public class CarDaoImpl extends BaseDaoImpl implements ICarDao {
    @Override
    public TBcCar info(String id) throws Exception {
        String hql="from TBcCar where id=:id";
        Map<String,Object> map=new HashMap<>();
        map.put("id",id);
        return (TBcCar) this.getHibernateDao().findEntityByHqlWithParams(hql,map);
    }

//    @Override
//    public TBcCar infoTwo(String id) throws Exception {
//        String hql="from TBcCarTwo where id=:id";
//        Map<String,Object> map=new HashMap<>();
//        map.put("id",id);
//        return (TBcCar) this.getHibernateDao().findEntityByHqlWithParams(hql,map);
//    }

    @Override
    public TBcCar infoByCode(String code) throws Exception {
        String hql="from TBcCar where carSeriesCode=:code";
        Map<String,Object> map=new HashMap<>();
        map.put("code",code);
        return (TBcCar) this.getHibernateDao().findEntityByHqlWithParams(hql,map);
    }
}
